package com.example.mac.yuejian14.activity;

<<<<<<< HEAD
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.example.mac.yuejian14.R;
import com.example.mac.yuejian14.bean.ActivityBean;
import com.example.mac.yuejian14.listener.RetrofitListener1;
import com.example.mac.yuejian14.model.ActivityModel;
import com.squareup.picasso.Picasso;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

import static com.example.mac.yuejian14.Const_Pic.BASE_URL;

public class ActivityDetailActivity extends BaseActivity implements RetrofitListener1 {
    private TextView actname, actintro, acttime, actaddress, actcall, actcost;
    private Button act_add;
    private static ImageView actpic;
    private ImageButton back;
    private ImageButton collection;
    private int actid;
    private int uid;

    @Override
    void initViews() {
        setLayout(R.layout.activity_detail);
        actname = (TextView) findViewById(R.id.actname);
        actintro = (TextView) findViewById(R.id.actintro);
        acttime = (TextView) findViewById(R.id.acttime);
        actaddress = (TextView) findViewById(R.id.actaddress);
        actcall = (TextView) findViewById(R.id.actcall);
        actpic = (ImageView) findViewById(R.id.actpic);
        actcost = (TextView) findViewById(R.id.actcost);

//        act_phone= (Button) findViewById(R.id.t_phone);
        act_add = (Button) findViewById(R.id.t_add);

        back = (ImageButton) findViewById(R.id.btn_back);
        collection = (ImageButton) findViewById(R.id.btn_collect);


        uid = getUid();
    }


    @Override
    void initEvents() {
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
//        act_phone.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                Intent intent = new Intent(Intent.ACTION_DIAL);
//                intent.setData(Uri.parse("tel:13342230113"));
//                startActivity(intent);
//            }
//        });
        act_add.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                Intent intent = new Intent(ActivityDetailActivity.this, ActivityApplyActivity.class);
                Bundle bundle = getIntent().getExtras();
                actid = bundle.getInt("actid");
                uid = bundle.getInt("uid");
                intent.putExtra("actid", actid);
                intent.putExtra("uid", uid);
                startActivity(intent);
            }
        });

    }

    @Override
    void initData() {
        Intent intent = getIntent();
        Bundle bundle = intent.getExtras();
        actid = bundle.getInt("actid");

        ActivityModel activityModel = new ActivityModel();
        activityModel.getActivityById(String.valueOf(actid), this);

    }


    @Override
    public void onSuccess(Object object, int flag) {
        ActivityBean activityBean = (ActivityBean) object;
        actname.setText(activityBean.getActname());
        actintro.setText(activityBean.getActintro());
        acttime.setText(activityBean.getActtime());
        actaddress.setText(activityBean.getActaddress());
        actcall.setText(activityBean.getActcall());
        actcost.setText("￥ " + activityBean.getActcost() + "元/人");
        String actpic = BASE_URL + activityBean.getActpic();
        if (!"".equals(activityBean.getActpic()))
            Picasso.with(ActivityDetailActivity.this).load(actpic).error(R.drawable.no_pic).into(ActivityDetailActivity.actpic);
    }

    @Override
    public void onFail() {

    }

}
=======
/**
 * Created by GaoNa on 2018/10/8.
 */

public class ActivityDetailActivity {
}
>>>>>>> 4629567011ce192c56b08540254859f8a556460d
